package sword_to_1;

import node.ListNode;

public class LeeCode_18 {
    public static void main(String[] args) {

    }
    private static ListNode deleteNode(ListNode head, int val) {
        ListNode dummy = new ListNode(0);
        dummy.next = head;
        ListNode now = head;
        ListNode pre = dummy;
        while (now.val != val){
            now = now.next;
            pre = pre.next;
        }
        pre.next = now.next;
        return dummy.next;
    }
}
